<?php
/*
 * Modelo para los detalles del Documentento del tipo libro (DocumentType::Book)
 */
class JasperReport extends Doctrine_Record {
		
	public function setTableDefinition() {
		$this->hasColumn('report_title', 'string', 50,
    	array(
    		'comment' => 'human readable report id.',
    		'notnull' => true,
      )
    );
    
    $this->hasColumn('description', 'string', 255,
    	array(
    		'comment' => 'Bried description about the report.'
      )
    );
    
    $this->hasColumn('filename', 'string', 255,
    	array(
    		'comment' => '',
    	  'notnull' => true,
      )
    );
    
    $this->hasColumn('parameters', 'string', 255,
    	array(
    		'comment' => 'Parameters needed by the report. This field is stored as a serialised php object.'
      )
    );
    
	}
	
	public function setUp() {
	}
	
  static public function getFilenameByJasperReport_Id($id) {
    $q = Doctrine_Query::create()
  			->select('filename')
  			->from('JasperReport')
  			->where('id = ?', $id);
  			
    $result = $q->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
    
	  return $result[0]['filename'];
	}

}
